<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<!--
		<link rel="stylesheet" type="text/css" href="styles.css">
		-->
		<title>粤教学练测平台</title>
		<meta name="viewport"
		content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="keywords" content="">
		<link rel="shortcut icon" href="<%=basePath%>resources/images/favicon.ico" />
		<link href="resources/bootstrap/css/bootstrap-huan.css" rel="stylesheet">
		<link href="resources/font-awesome/css/font-awesome.min.css"
		rel="stylesheet">
		<link href="resources/css/style.css" rel="stylesheet">
		<!-- Javascript files -->
		<style type="text/css">
			.form-group {
				margin-bottom: 5px;
				height: 59px;
			}
			#form-create-account {
				margin: 20px 0px;
			}
			#form-create-account label {
				font-weight: normal !important;
				font-size: 14px;
				color: #9a9a9a;
			}
		</style>
	</head>

	<body>
		<header>
			<div class="container">
				<div class="row">
					<div class="col-xs-5">
						<div class="logo">
							<h1><a href="#">学测练管理平台</a></h1>
							<div class="hmeta">
								专注互联网在线考试解决方案
							</div>
						</div>
					</div>
					<div class="col-xs-7" id="login-info">
						<c:choose>
							<c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}">
								<div id="login-info-user" class="hmeta">
									
									<a href="user-detail/${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}" id="system-info-account" target="_blank">${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}</a>
									<span>|</span>
									<a href="j_spring_security_logout"><i class="fa fa-sign-out"></i> 退出</a>
								</div>
							</c:when>
							<c:otherwise>
								<a class="btn btn-primary" href="user-register">用户注册</a>
								<a class="btn btn-success" href="user-login-page">登录</a>
							</c:otherwise>
						</c:choose>
					</div>
				</div>
			</div>
		</header>
		<!-- Navigation bar starts -->

		<div class="navbar bs-docs-nav" role="banner">
			<div class="container">
				<nav class="collapse navbar-collapse bs-navbar-collapse"
				role="navigation">
					<ul class="nav navbar-nav">
						<li>
							<a href="home" style="display:none"><i class="fa fa-home"></i>主页</a>
						</li>
						<li>
							<a href="start-exam"><i class="fa fa-edit"></i>试题练习</a>
						</li>
						<li>
							<a href="student/usercenter"><i class="fa fa-dashboard"></i>个人中心</a>
						</li>
						<li>
							<a href="student/setting"><i class="fa fa-cogs"></i>个人设置</a>
						</li>
					</ul>
				</nav>
			</div>
		</div>

		<!-- Navigation bar ends -->

		<div class="content" style="margin-bottom: 100px;">

			<div class="container">
				<div class="row">

					<div class="col-md-12">
						<div class="lrform">
							<h5>注册账号</h5>
							<span class="form-message"></span>
							<div class="form">
								<!-- Register form (not working)-->
								<div class="form-horizontal" id="form-create-account">
									<!-- Name -->
									<div class="form-group form-username">
										<label class="control-label col-md-3" for="name">学生学号:</label>
										<div class="col-md-9">
											<input type="text" class="form-control" id="name">
											<span class="form-message"></span>
										</div>
									</div>

									<!-- password -->
									<div class="form-group form-password">
										<label class="control-label col-md-3" for="set_password">设置密码:</label>
										<div class="col-md-9">
											<input type="password" class="form-control" id="set_password">
											<span class="form-message"></span>
										</div>

									</div>
									<!-- password-confirm -->
									<div class="form-group form-password-confirm">
										<label class="control-label col-md-3" for="password-confirm">确认密码:</label>
										<div class="col-md-9">
											<input type="password" class="form-control" id="password-confirm">
											<span class="form-message"></span>
										</div>

									</div>
									
									<div class="form-group form-school-select">
										<label class="control-label col-md-3">所在学校:</label>
										<div class="col-md-9">
											<select class="form-control" id="select-school-input">
												<option value="-1">--请选择--</option>
												<c:forEach items="${schoolList }" var="item">
													<option value="${item.stud_school }">${item.stud_school }</option>
												</c:forEach>
											</select>
											<span class="form-message"></span>
										</div>
									</div>
									<div class="form-group form-grade-select">
										<label class="control-label col-md-3">所在年级:</label>
										<div class="col-md-9">
											<select class="form-control" id="select-grade-input">
												<option value="-1">--请选择--</option>
											</select>
											<span class="form-message"></span>
										</div>
									</div>
									<div class="form-group form-class-select">
										<label class="control-label col-md-3">所在班级:</label>
										<div class="col-md-9">
											<select class="form-control" id="select-class-input">
												<option value="-1">--请选择--</option>
											</select>
											<span class="form-message"></span>
										</div>
									</div>
									<div class="form-group form-turename">
										<label class="control-label col-md-3" for="truename">学生姓名:</label>
										<div class="col-md-9">
											<input type="text" class="form-control" id="truename">
											<span class="form-message"></span>
										</div>

									</div>
									<div class="form-group form-sex-select">
										<label class="control-label col-md-3">用户性别:</label>
										<div class="col-md-9">
											<select class="form-control" id="select-sex-input">
												<option value="0">--请选择--</option>
												<option value="1">男</option>
												<option value="2">女</option>
											</select>
											<span class="form-message"></span>
										</div>
									</div>

									<!-- Buttons -->
									<div class="form-group">
										<!-- Buttons -->
										<div class="col-md-9 col-md-offset-3">
											<button class="btn" id="btn-reg">
												注册账号
											</button>
											<button type="reset" class="btn">
												重置
											</button>
										</div>
									</div>
								</div>
								已有账号? <a href="user-login-page">直接登录</a>
							</div>
						</div>

					</div>
				</div>

			</div>

		</div>
		<footer>
			<div class="container">
				<div class="row">
					<div class="col-md-12">
						<div class="copy" style="display:none">
							<p>
								粤教学练测平台 Copyright © <a href="http://www.examxx.net/" target="_blank">粤教学练测平台</a> - <a href="." target="_blank">主页</a> | <a href="http://www.examxx.net/" target="_blank">关于我们</a> | <a href="http://www.examxx.net/" target="_blank">FAQ</a> | <a href="http://www.examxx.net/" target="_blank">联系我们</a>
							</p>
						</div>
					</div>
				</div>

			</div>

		</footer>

		<!-- Slider Ends -->
		<!-- jQuery -->
		<script type="text/javascript" src="resources/js/jquery/jquery-1.9.0.min.js"></script>
		<!-- Bootstrap JS -->
		<script type="text/javascript" src="resources/bootstrap/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="resources/js/register.js"></script>
		<script>
			$(function () {
				$('#select-school-input').change(function () {
                    $(".form-school-select .form-message").empty();
                    $("#select-grade-input option[value!='-1']").remove();
                    $("#select-class-input option[value!='-1']").remove();
                    $("#select-grade-input").val("-1");
                    $("#select-class-input").val("-1");
                    $.get("/school/grade_list", { stud_school:$(this).val()},function (data,status) {
						if(data.length > 0){
						    for(var i = 0; i < data.length; i++){
						        item = data[i];
                                $("#select-grade-input").append("<option value='"+item.stud_grade+"'>"+item.stud_grade+"</option>");
                            }
						}
                    });
                });
                $('#select-grade-input').change(function () {
                    $(".form-grade-select .form-message").empty();
                    $('#select-class-input').val("-1");
                    $.get("/school/class_list", { stud_school:$('#select-school-input').val(),stud_grade:$(this).val()},function (data,status) {
                        if(data.length > 0){
                            for(var i = 0; i < data.length; i++){
                                item = data[i];
                                $("#select-class-input").append("<option value='"+item.stud_class+"'>"+item.stud_class+"</option>");
                            }
                        }
                    });
                });
                $('#select-class-input').change(function () {
                    $(".form-class-select .form-message").empty();
				});
            })
		</script>
	</body>
</html>
